package com.liao.servlet;

import com.liao.service.PatientRandomExtractService;
import com.liao.service.Top10CategoryService;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.io.IOException;

@WebServlet("/top10Category")
public class Top10CategoryServlet extends HttpServlet {

    @Override
    public void service(ServletRequest req, ServletResponse response) throws ServletException, IOException {
        Top10CategoryService service=new Top10CategoryService();
        String json=service.findAll();
        //2.响应结果
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().write(json);
    }
}
/*

[
    {
        "taskId":"2",
        "categoryId":111,
        "clickCount":22,
        "orderCount":56,
        "payCount":74
    },
    {
        "taskId":"1",
        "categoryId":2,
        "clickCount":3,
        "orderCount":4,
        "payCount":5
    },
    {
        "taskId":"11",
        "categoryId":12,
        "clickCount":13,
        "orderCount":14,
        "payCount":15
    },
    {
        "taskId":"16",
        "categoryId":17,
        "clickCount":18,
        "orderCount":19,
        "payCount":20
    },
    {
        "taskId":"21",
        "categoryId":22,
        "clickCount":23,
        "orderCount":24,
        "payCount":25
    },
    {
        "taskId":"26",
        "categoryId":27,
        "clickCount":28,
        "orderCount":29,
        "payCount":30
    },
    {
        "taskId":"31",
        "categoryId":32,
        "clickCount":33,
        "orderCount":34,
        "payCount":35
    },
    {
        "taskId":"36",
        "categoryId":37,
        "clickCount":38,
        "orderCount":39,
        "payCount":40
    },
    {
        "taskId":"41",
        "categoryId":42,
        "clickCount":43,
        "orderCount":44,
        "payCount":45
    },
    {
        "taskId":"46",
        "categoryId":47,
        "clickCount":48,
        "orderCount":49,
        "payCount":50
    }
]

 */